import toml

class InvalidTokenException(Exception):
    pass


class Config(object):
    def __init__(self):
        config = self.read_config("./config.toml")

        # 设置所需参数
        self.atomgit_app_id = config.get("ATOMGIT_APP_ID")
        self.atomgit_app_pem_file_path = config.get("ATOMGIT_APP_PEM_FILE_PATH")
        self.webhook_secret = config.get("WEBHOOK_SECRET")
        self.huawei_cloud_endpoint = config.get("HUAWAI_CLOUD_ENDPOINT")
        self.huawei_cloud_doname = config.get("HUAWAI_CLOUD_DONAME")
        self.huawei_cloud_username = config.get("HUAWAI_CLOUD_USERNAME")
        self.huawei_cloud_password = config.get("HUAWAI_CLOUD_PASSWORD")

    def read_config(self, filename):
        with open(filename, "r") as file:
            config = toml.load(file)
        return config